<!-- 首页 -->
<template>
    <view class="home-wrap u-m-b-20">
        <view class="content-box">
            <view v-if="!isEmpty">
                <view class="collect-list u-m-t-20" v-for="(goods, index) in myGroupList" :key="index">
                    <shopro-list-item :option="goods" @jumpTaskDetail="jumpTaskDetail"></shopro-list-item>
                </view>
            </view>
            <!-- 数据为空 -->
            <shopro-empty v-if="isEmpty" :image="require('@/static/images/nomsg.png')" tipText="暂无内容~">
            </shopro-empty>
            <!-- 更多 -->
            <u-loadmore v-show="!isEmpty" height="80rpx" :status="loadStatus" icon-type="flower" color="#ccc"/>
        </view>
    </view>
</template>

<script>
let systemInfo = uni.getSystemInfoSync();
import {mapMutations, mapActions, mapState, mapGetters} from 'vuex';
export default {
    components: {},
    data() {
        return {
            chengyuanItem: {},
            colorArr     : ['#00BFFF', '#4ff279', '#FFC1C1', '#E066FF', '#FF7F00', '#FF34B3'],
            isEmpty      : false,
            isRefresh    : true,
            isScorll     : false,
            showDetel    : false,
            showModal    : false,
            myGroupList  : [],
            tagList      : [],
            tagchecked   : '',
            position     : "",
            tagindex     : '',
            isedit       : false,
            loadStatus   : 'loadmore', //loadmore-加载前的状态，loading-加载中的状态，nomore-没有更多的状态
            currentPage  : 1,
            lastPage     : 1,
            total        : ''
        };
    },
    computed: {
        ...mapGetters(['isLogin', 'userInfo']),
    },
    created() {
        this.getmyGroupList();
        // 触底监听
        uni.$on('uOnReachBottom', data => {
            if (this.lastPage) {
                this.currentPage += 1;
                this.getmyGroupList();
            }
        });
    },
    onPullDownRefresh() {
        // this.getmyGroupList();
    },
    onShow() {
        let that    = this;
        this.enable = true;
    },
    onHide() {
        this.enable = false;
    },
    onLoad() {

    },
    mounted() {
    },
    watch  : {},
    methods: {
        jumpTaskDetail(id,status){
            this.jump('/pages-list/taskDetail',{task_id:id,status:status})
        },

        // 初始化
        init() {
            this.isRefresh = false;
        },
        // 路由跳转
        jump(path, parmas) {
            console.log('-----11111');
            this.$Router.push({
                path : path,
                query: parmas
            });
        },
        // 组织成员列表
        getmyGroupList() {
            let that = this;
            that.$http('login.mytaskList', {
                page    : that.currentPage,
                pagesize: 10
            }).then(res => {
                that.myGroupList = [...that.myGroupList, ...res.data];
                that.isEmpty     = !that.myTaskList.length;
                that.lastPage    = (res.data == 10);
                that.loadStatus  = (res.data == 10) ? 'loadmore' : 'nomore';
            });
        },
    }
};
</script>

<style lang="scss">
.home-wrap {
    padding: 0 30rpx 30rpx;
}

//nav
page {
    background: #f8f8f8;
}

.userInfo {
    margin-top: 20rpx;
    margin-bottom: 20rpx;

    .userleft {
        .usertitle {
            font-size: 30rpx;
        }
    }

    .userright {
        padding: 4rpx 24rpx;
        background: #0081ff;
        border-radius: 45rpx;
        color: #FFFFFF;
        font-size: 24rpx;
        margin: 0;
    }

}

.zixun-item {
    border-radius: 20rpx;
    background: #fff;

    .zixuntitle {
        color: #333;
        font-size: 30rpx;
    }

    .zixunimg {
        width: 100%;
        height: 180rpx;

        image {
            width: 100%;
            height: 100%;
        }
    }

    .zixuntime {
        color: #cccccc;
        font-size: 24rpx;
    }

    .yichu {
        padding: 16rpx 26rpx;
        border-radius: 34rpx;
        background: #0081ff;
        color: #fff;
    }

    .tag {
        background: #fff;
        color: #5e00ff;
        padding: 10rpx 18rpx;
        font-size: 20rpx;
        border-radius: 34rpx;
        border: 2rpx solid #5e00ff;
    }
}

.detlebtn {
    height: 80rpx;
    background: #0081ff;
    width: 80rpx;
    border-radius: 50%;
}

// 提示
.notice-modal {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    width: 85vw;
    min-height: 358rpx;
    background: #ffffff;
    padding: 30rpx;
    border-radius: 20rpx;

    .notice-title {
        width: 100%;
        font-size: 30rpx;
        font-weight: bold;
        color: #46351b;
        text-align: center;
    }

    .notice-detail {
        font-size: 24rpx;
        font-weight: 400;
        color: #999999;
        line-height: 36rpx;
        margin-bottom: 50rpx;
    }

    .back-btn {
        width: 45%;
        height: 70rpx;
        line-height: 70rpx;
        background: #f8f8f8;
        box-shadow: 0 7rpx 8rpx 2rpx #ccc;
        border-radius: 35rpx;
        font-size: 26rpx;
        font-weight: 500;
        color: #333;
        margin-bottom: 10rpx;
    }

    .notice-btn {
        width: 45%;
        height: 70rpx;
        line-height: 70rpx;
        font-size: 26rpx;
        font-weight: 500;
        color: #fff;
        border-radius: 35rpx;
        background: linear-gradient(90deg, #3357DB 0%, #3469E1 47%, #3597F1 100%);
        box-shadow: 0 7rpx 8rpx 2rpx #3597F1;
    }
}

// 弹窗
.modal-box {
    width: 750rpx;
    border-radius: 30rpx 30rpx 0 0;
    background: #fff;

    .modal-head {
        height: 92rpx;
        border-bottom: 1px solid rgba(223, 223, 223, 0.5);
        padding: 0 30rpx;

        .head-title {
            font-size: 32rpx;
            font-weight: bold;
        }
    }

    .modal-content {
        padding: 0 30rpx;

        .into-item {
            width: 24%;
            margin-right: 7rpx;
            padding: 10rpx 0;
            border: 2rpx solid #f3f4f6;
            color: #333;
            border-radius: 30rpx;
            display: flex;
            justify-content: center;
            align-items: center;

            &.active {
                color: #fff;
                background: #0081ff;
            }
        }
    }

    .modal-foot {
        font-size: 24rpx;
        padding: 20rpx 0;
        font-weight: 500;
        color: rgba(153, 153, 153, 1);
        border-top: 1px solid rgba(223, 223, 223, 0.5);

        .back-btn {
            width: 45%;
            height: 70rpx;
            line-height: 70rpx;
            background: #f8f8f8;
            box-shadow: 0 7rpx 8rpx 2rpx #ccc;
            border-radius: 35rpx;
            font-size: 28rpx;
            font-weight: 500;
            color: #333;
            margin-bottom: 10rpx;
        }

        .notice-btn {
            width: 45%;
            height: 70rpx;
            line-height: 70rpx;
            font-size: 28rpx;
            font-weight: 500;
            color: #fff;
            border-radius: 35rpx;
            background: linear-gradient(90deg, #3357DB 0%, #3469E1 47%, #3597F1 100%);
            box-shadow: 0 7rpx 8rpx 2rpx #3597F1;
        }
    }
}
</style>
